package com.local.manager.thread;

import java.io.IOException;

import com.cz0735.led.utils.CommondUtil;
import com.cz073586.tools.util.Tools;
import com.local.common.CommonContains;
import com.local.model.Screen;
import com.qianhai.common.utils.Log4jUtil;

public class ScreenLightThread implements Runnable {
	
	private static Log4jUtil log = Log4jUtil.getLog4j(ScreenLightThread.class);
	
	
	private Screen screen;
	
	public ScreenLightThread(Screen screen) {
		super();
		this.screen = screen;
	}

	@Override
	public void run() {
		log.debug("---------------开始发送信号灯命令------------");
		if(!Tools.isEmpty(screen)&&CommonContains.LIGHT_FLAG.equals(screen.getAttr1())){
			try {
				CommondUtil.openSwitch(screen.getScreenIp(), Integer.valueOf(screen.getPortNo()), Integer.valueOf(screen.getScreenNo()));
			} catch (NumberFormatException e) {
				log.error("发送信号灯命令类型转换异常");
			} catch (IOException e) {
				log.error("发送信号灯命令IO异常");
			}
		}
	}

}
